﻿module Sustainalytics.LRTM {

    // Client LRTM directive.
    export class LongRunningTaskManagerBehavior {


        // controller associated with current directive
        private controller: LongRunningTaskManagerController;

        constructor(
            private scope,
            private element,
            private attrs) {

            // get controller
            this.controller = scope['lrtm'];
        }
    }

    
    var directive = function () {
        return {
            // restrict usage for elements
            restrict: 'E',

            // generate child scope
            scope: true,

            // associate LRTM controller
            controller: 'LongRunningTaskManagerController',

            // LRTM view
            templateUrl: 'Views/LongRunningTaskManager.html',

            // replace target element with templateUrl content
            replace: true,

            // link function for attaching event handlers and applying scope
            link: function (scope, element, attrs) {
                var behavior = new LongRunningTaskManagerBehavior(scope, element, attrs);
            }
        };
    };

    // register directive
    angular.module('Sustainalytics.LRTM').directive('sustainalyticsLrtm', [directive]);

}